package org.zfes.snowier.zbss.xzy.router.others;

import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.config.model.ConfigCate;
import org.zfes.snowier.zbss.xzy.biz.config.service.IConfigCateService;
@Controller 
@RequestMapping("/xzy/aIConfigCate")
public class AIConfigCateController implements BaseController {

	
	@Autowired
	private IConfigCateService aIConfigCateService;
	
    @RequestMapping(value="/loadAIConfigCateDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadAIConfigCateDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  aIConfigCateService.loadAIConfigCateDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
    
    @RequestMapping(value="/loadAllAIConfigCate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadAllAIConfigCate(Byte status){
	    List<ConfigCate> cateList=  aIConfigCateService.loadAIConfigCates(null);
	    return ajaxQuery("cateList", cateList);
    }
    
	
    @RequestMapping(value="/createAIConfigCate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createAIConfigCate(ConfigCate aIConfigCate){
		aIConfigCateService.createAIConfigCate(aIConfigCate);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
    @RequestMapping(value="/loadAIConfigCate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadAIConfigCate(Long id){
		Optional<ConfigCate> ops = aIConfigCateService.loadAIConfigCateById(id);
		return ajaxQuery("aIConfigCate",ops);
    }
	
    @RequestMapping(value="/updateAIConfigCate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateAIConfigCate(ConfigCate aIConfigCate){
		aIConfigCateService.updateAIConfigCate(aIConfigCate);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
    @RequestMapping(value="/deleteAIConfigCate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteAIConfigCate(Long id){
		aIConfigCateService.deleteAIConfigCate(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }
    
    @RequestMapping(value="/setAIConfigCateStatus", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object setAIConfigCateStatus(Long id,Byte status){
		aIConfigCateService.setAIConfigCateStatus(id, status);
		return ajaxDoneSuccess("数据操作成功 ");
    }
    
    
}